
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>环境部署 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex/katex.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-emphasize/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-codeblock-label/block.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-click-reveal/click_reveal.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-interactive/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    


    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="gdb.html" />
    
    
    <link rel="prev" href="../../notes/log.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    实验简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../../notes/log.html">
            
                <a href="../../notes/log.html">
            
                    
                    更新日志
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">实验之前</li>
        
        
    
        <li class="chapter active" data-level="2.1" data-path="env.html">
            
                <a href="env.html">
            
                    
                    环境部署
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="gdb.html">
            
                <a href="gdb.html">
            
                    
                    GDB 调试方法*
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">实验指导</li>
        
        
    
        <li class="chapter " data-level="3.1" >
            
                <span>
            
                    
                    实验指导零
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="../lab-0/guide/intro.html">
            
                <a href="../lab-0/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="../lab-0/guide/part-1.html">
            
                <a href="../lab-0/guide/part-1.html">
            
                    
                    创建项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="../lab-0/guide/part-2.html">
            
                <a href="../lab-0/guide/part-2.html">
            
                    
                    移除标准库依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="../lab-0/guide/part-3.html">
            
                <a href="../lab-0/guide/part-3.html">
            
                    
                    移除运行时环境依赖
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="../lab-0/guide/part-4.html">
            
                <a href="../lab-0/guide/part-4.html">
            
                    
                    编译为裸机目标
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.6" data-path="../lab-0/guide/part-5.html">
            
                <a href="../lab-0/guide/part-5.html">
            
                    
                    生成内核镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7" data-path="../lab-0/guide/part-6.html">
            
                <a href="../lab-0/guide/part-6.html">
            
                    
                    调整内存布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8" data-path="../lab-0/guide/part-7.html">
            
                <a href="../lab-0/guide/part-7.html">
            
                    
                    重写程序入口点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.9" data-path="../lab-0/guide/part-8.html">
            
                <a href="../lab-0/guide/part-8.html">
            
                    
                    使用 QEMU 运行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.10" data-path="../lab-0/guide/part-9.html">
            
                <a href="../lab-0/guide/part-9.html">
            
                    
                    接口封装和代码整理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.11" data-path="../lab-0/guide/summary.html">
            
                <a href="../lab-0/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.2" >
            
                <span>
            
                    
                    实验指导一
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="../lab-1/guide/intro.html">
            
                <a href="../lab-1/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="../lab-1/guide/part-1.html">
            
                <a href="../lab-1/guide/part-1.html">
            
                    
                    什么是中断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="../lab-1/guide/part-2.html">
            
                <a href="../lab-1/guide/part-2.html">
            
                    
                    RISC-V 中的中断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.4" data-path="../lab-1/guide/part-3.html">
            
                <a href="../lab-1/guide/part-3.html">
            
                    
                    程序运行状态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.5" data-path="../lab-1/guide/part-4.html">
            
                <a href="../lab-1/guide/part-4.html">
            
                    
                    状态的保存与恢复
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.6" data-path="../lab-1/guide/part-5.html">
            
                <a href="../lab-1/guide/part-5.html">
            
                    
                    进入中断处理流程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.7" data-path="../lab-1/guide/part-6.html">
            
                <a href="../lab-1/guide/part-6.html">
            
                    
                    时钟中断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.8" data-path="../lab-1/guide/summary.html">
            
                <a href="../lab-1/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" >
            
                <span>
            
                    
                    实验指导二
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="../lab-2/guide/intro.html">
            
                <a href="../lab-2/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="../lab-2/guide/part-1.html">
            
                <a href="../lab-2/guide/part-1.html">
            
                    
                    动态内存分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.3" data-path="../lab-2/guide/part-2.html">
            
                <a href="../lab-2/guide/part-2.html">
            
                    
                    物理内存探测
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.4" data-path="../lab-2/guide/part-3.html">
            
                <a href="../lab-2/guide/part-3.html">
            
                    
                    物理内存管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.5" data-path="../lab-2/guide/summary.html">
            
                <a href="../lab-2/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" >
            
                <span>
            
                    
                    实验指导三
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="../lab-3/guide/intro.html">
            
                <a href="../lab-3/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="../lab-3/guide/part-1.html">
            
                <a href="../lab-3/guide/part-1.html">
            
                    
                    从虚拟地址到物理地址
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3" data-path="../lab-3/guide/part-2.html">
            
                <a href="../lab-3/guide/part-2.html">
            
                    
                    修改内核
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.4" data-path="../lab-3/guide/part-3.html">
            
                <a href="../lab-3/guide/part-3.html">
            
                    
                    实现页表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.5" data-path="../lab-3/guide/part-4.html">
            
                <a href="../lab-3/guide/part-4.html">
            
                    
                    实现内核重映射
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.6" data-path="../lab-3/guide/part-5.html">
            
                <a href="../lab-3/guide/part-5.html">
            
                    
                    页面置换*
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.7" data-path="../lab-3/guide/summary.html">
            
                <a href="../lab-3/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" >
            
                <span>
            
                    
                    实验指导四
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="../lab-4/guide/intro.html">
            
                <a href="../lab-4/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2" data-path="../lab-4/guide/part-1.html">
            
                <a href="../lab-4/guide/part-1.html">
            
                    
                    线程和进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.3" data-path="../lab-4/guide/part-2.html">
            
                <a href="../lab-4/guide/part-2.html">
            
                    
                    线程的创建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.4" data-path="../lab-4/guide/part-3.html">
            
                <a href="../lab-4/guide/part-3.html">
            
                    
                    线程的切换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.5" data-path="../lab-4/guide/part-4.html">
            
                <a href="../lab-4/guide/part-4.html">
            
                    
                    线程的结束
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.6" data-path="../lab-4/guide/part-5.html">
            
                <a href="../lab-4/guide/part-5.html">
            
                    
                    内核栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.7" data-path="../lab-4/guide/part-6.html">
            
                <a href="../lab-4/guide/part-6.html">
            
                    
                    线程调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.8" data-path="../lab-4/guide/summary.html">
            
                <a href="../lab-4/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" >
            
                <span>
            
                    
                    实验指导五
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="../lab-5/guide/intro.html">
            
                <a href="../lab-5/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.2" data-path="../lab-5/guide/part-1.html">
            
                <a href="../lab-5/guide/part-1.html">
            
                    
                    设备树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.3" data-path="../lab-5/guide/part-2.html">
            
                <a href="../lab-5/guide/part-2.html">
            
                    
                    virtio
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.4" data-path="../lab-5/guide/part-3.html">
            
                <a href="../lab-5/guide/part-3.html">
            
                    
                    驱动和块设备驱动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.5" data-path="../lab-5/guide/part-4.html">
            
                <a href="../lab-5/guide/part-4.html">
            
                    
                    文件系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.6" data-path="../lab-5/guide/summary.html">
            
                <a href="../lab-5/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" >
            
                <span>
            
                    
                    实验指导六
            
                </span>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="../lab-6/guide/intro.html">
            
                <a href="../lab-6/guide/intro.html">
            
                    
                    摘要
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.2" data-path="../lab-6/guide/part-1.html">
            
                <a href="../lab-6/guide/part-1.html">
            
                    
                    构建用户程序框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.3" data-path="../lab-6/guide/part-2.html">
            
                <a href="../lab-6/guide/part-2.html">
            
                    
                    打包为磁盘镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.4" data-path="../lab-6/guide/part-3.html">
            
                <a href="../lab-6/guide/part-3.html">
            
                    
                    解析 ELF 文件并创建线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.5" data-path="../lab-6/guide/part-4.html">
            
                <a href="../lab-6/guide/part-4.html">
            
                    
                    实现系统调用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.6" data-path="../lab-6/guide/part-5.html">
            
                <a href="../lab-6/guide/part-5.html">
            
                    
                    处理文件描述符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.7" data-path="../lab-6/guide/part-6.html">
            
                <a href="../lab-6/guide/part-6.html">
            
                    
                    条件变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.8" data-path="../lab-6/guide/summary.html">
            
                <a href="../lab-6/guide/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">实验题</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../lab-1/practice.html">
            
                <a href="../lab-1/practice.html">
            
                    
                    实验一：中断
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../lab-2/practice.html">
            
                <a href="../lab-2/practice.html">
            
                    
                    实验二：内存分配
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../lab-3/practice.html">
            
                <a href="../lab-3/practice.html">
            
                    
                    实验三：虚实地址转换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../lab-4/practice-1.html">
            
                <a href="../lab-4/practice-1.html">
            
                    
                    实验四（上）：线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../lab-4/practice-2.html">
            
                <a href="../lab-4/practice-2.html">
            
                    
                    实验四（下）：线程调度
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="../lab-6/practice.html">
            
                <a href="../lab-6/practice.html">
            
                    
                    实验六：系统调用
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">开发笔记</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../format/partition.html">
            
                <a href="../format/partition.html">
            
                    
                    文档代码划分
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../format/doc.html">
            
                <a href="../format/doc.html">
            
                    
                    文档格式规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../format/code.html">
            
                <a href="../format/code.html">
            
                    
                    代码格式规范
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >环境部署</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x73AF;&#x5883;&#x90E8;&#x7F72;">&#x73AF;&#x5883;&#x90E8;&#x7F72;</h1>
<p>&#x5728;&#x5F00;&#x5C55;&#x5B9E;&#x9A8C;&#x4E4B;&#x524D;&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x6839;&#x636E;&#x4E0D;&#x540C;&#x7684;&#x5E73;&#x53F0;&#x63D0;&#x524D;&#x5B89;&#x88C5;&#x76F8;&#x5173;&#x4F9D;&#x8D56;&#x7684;&#x8F6F;&#x4EF6;&#x5305;&#xFF0C;&#x5177;&#x4F53;&#x9700;&#x8981;&#x7684;&#x8F6F;&#x4EF6;&#x5305;&#x5982;&#x4E0B;&#xFF1A;</p>
<ul>
<li>Rust &#x5DE5;&#x5177;&#x94FE;<ul>
<li>Rust &#x7248;&#x672C;&#x7BA1;&#x7406;&#x5DE5;&#x5177;&#xFF1A;rustup</li>
<li>Rust &#x8F6F;&#x4EF6;&#x5305;&#x7BA1;&#x7406;&#x5DE5;&#x5177;&#xFF1A;cargo</li>
<li>Rust &#x7F16;&#x8BD1;&#x5668;&#xFF1A;rustc</li>
<li>&#x7B49;&#x7B49;</li>
</ul>
</li>
<li>&#x865A;&#x62DF;&#x673A;&#x8F6F;&#x4EF6;&#xFF1A;QEMU &#xFF08;&#x7248;&#x672C;&#x81F3;&#x5C11;&#x652F;&#x6301; RISC-V 64&#xFF09;</li>
</ul>
<p>&#x5177;&#x4F53;&#x5B89;&#x88C5;&#x7684;&#x65B9;&#x6CD5;&#x5728;&#x4E0D;&#x540C;&#x5E73;&#x53F0;&#x4E0A;&#x5B89;&#x88C5;&#x65B9;&#x5F0F;&#x7C7B;&#x4F3C;&#xFF0C;&#x4F46;&#x4E5F;&#x6709;&#x7EC6;&#x5FAE;&#x5DEE;&#x522B;&#xFF0C;&#x540E;&#x9762;&#x4F1A;&#x6709;&#x5177;&#x4F53;&#x8BF4;&#x660E;&#x3002;</p>
<!-- TODO: Normal Windows -->
<h2 id="&#x5B89;&#x88C5;-qemu">&#x5B89;&#x88C5; QEMU</h2>
<p>&#x6839;&#x636E;&#x4E0D;&#x540C;&#x5E73;&#x53F0;&#xFF0C;&#x6211;&#x4EEC;&#x5206;&#x4E3A;&#x4E0B;&#x9762; 3 &#x4E2A;&#x90E8;&#x5206;&#x6765;&#x4ECB;&#x7ECD;&#x3002;</p>
<h3 id="macos">macOS</h3>
<p>&#x5728; macOS &#x4E2D;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x6253;&#x5F00;&#x547D;&#x4EE4;&#x884C;&#x7528; Homebrew &#x8F6F;&#x4EF6;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x6765;&#x5B89;&#x88C5;&#x6700;&#x65B0;&#x7248; QEMU &#x548C;&#x5176;&#x4F9D;&#x8D56;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash">brew install qemu
</code></pre>
<h3 id="linux">Linux</h3>
<p>&#x5728; Linux &#x4E2D;&#xFF0C;&#x7531;&#x4E8E;&#x5F88;&#x591A;&#x8F6F;&#x4EF6;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x7684;&#x9ED8;&#x8BA4;&#x8F6F;&#x4EF6;&#x6E90;&#x4E2D;&#x5305;&#x542B;&#x7684; QEMU &#x7248;&#x672C;&#x8FC7;&#x4F4E;&#xFF0C;&#x8FD9;&#x91CC;<strong>&#x63A8;&#x8350;</strong>&#x7684;&#x65B9;&#x5F0F;&#x662F;&#x6211;&#x4EEC;&#x81EA;&#x5DF1;&#x624B;&#x52A8;&#x4ECE;&#x6E90;&#x7801;&#x7F16;&#x8BD1;&#x5B89;&#x88C5;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash"><span class="hljs-comment"># &#x4E0B;&#x8F7D;&#x6E90;&#x7801;&#x5305; &#xFF08;&#x5982;&#x679C;&#x4E0B;&#x8F7D;&#x901F;&#x5EA6;&#x8FC7;&#x6162;&#x53EF;&#x4EE5;&#x628A;&#x5730;&#x5740;&#x66FF;&#x6362;&#x4E3A;&#x6211;&#x4EEC;&#x63D0;&#x4F9B;&#x7684;&#x5730;&#x5740;&#xFF1A;http://42.194.184.212:5212/#/s/4dHZ&#xFF09;</span>
wget https://download.qemu.org/qemu-5.0.0.tar.xz
<span class="hljs-comment"># &#x89E3;&#x538B;</span>
tar xvJf qemu-5.0.0.tar.xz
<span class="hljs-comment"># &#x7F16;&#x8BD1;&#x5B89;&#x88C5;&#x5E76;&#x914D;&#x7F6E; RISC-V &#x652F;&#x6301;</span>
<span class="hljs-built_in">cd</span> qemu-5.0.0
./configure --target-list=riscv32-softmmu,riscv64-softmmu
make -j$(nproc)
sudo make install
</code></pre>
<p>&#x5982;&#x679C;&#x5728;&#x8FD0;&#x884C; <code>configure</code> &#x65F6;&#x9047;&#x5230;&#x8F6F;&#x4EF6;&#x5305;&#x4F9D;&#x8D56;&#x7684;&#x95EE;&#x9898;&#xFF08;&#x4EE5; Ubuntu &#x7CFB;&#x7EDF;&#x4E3E;&#x4F8B;&#xFF09;&#xFF1A;</p>
<ul>
<li>&#x51FA;&#x73B0; <code>ERROR: pkg-config binary &apos;pkg-config&apos; not found</code> &#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <code>sudo apt-get install pkg-config</code> &#x5B89;&#x88C5;&#xFF1B;</li>
<li>&#x51FA;&#x73B0; <code>ERROR: glib-2.48 gthread-2.0 is required to compile QEMU</code> &#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <code>sudo apt-get install libglib2.0-dev</code> &#x5B89;&#x88C5;&#xFF1B;</li>
<li>&#x51FA;&#x73B0; <code>ERROR: pixman &gt;= 0.21.8 not present</code> &#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <code>sudo apt-get install libpixman-1-dev</code> &#x5B89;&#x88C5;&#x3002;</li>
</ul>
<p>&#x5982;&#x679C;&#x6709;&#x5176;&#x4ED6;&#x95EE;&#x9898;&#xFF0C;&#x8BF7;&#x9488;&#x5BF9;&#x4E0D;&#x540C;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x5728;&#x8F6F;&#x4EF6;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x4E2D;&#x67E5;&#x627E;&#x5E76;&#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#x3002;</p>
<p>&#x5F53;&#x7136;&#x5982;&#x679C;&#x4F60;&#x53EF;&#x4EE5;&#x627E;&#x5230;&#x5305;&#x542B;&#x8F83;&#x65B0;&#x7248;&#x672C;&#x7684; QEMU &#x7684;&#x8F6F;&#x4EF6;&#x5305;&#x6E90;&#xFF0C;<strong>&#x4E5F;&#x53EF;&#x4EE5;</strong>&#x901A;&#x8FC7;&#x8F6F;&#x4EF6;&#x5305;&#x7BA1;&#x7406;&#x5668;&#x76F4;&#x63A5;&#x5B89;&#x88C5;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash"><span class="hljs-comment"># Ubuntu / Debian / Windows WSL</span>
sudo apt-get install qemu

<span class="hljs-comment"># CentOS / Fedora / RedHat / SUSE</span>
sudo yum install qemu
</code></pre>
<h3 id="windows-wsl-2">Windows WSL 2</h3>
<p><a href="https://docs.microsoft.com/zh-cn/windows/wsl/" target="_blank">WSL</a>&#xFF08;Windows Subsystem for Linux&#xFF09;&#x662F;&#x6307; Windows &#x4E0B;&#x6784;&#x5EFA; Linux &#x73AF;&#x5883;&#x3002;&#x4F60;&#x53EF;&#x4EE5;&#x5728;&#x4F7F;&#x7528; Windows &#x7684;&#x540C;&#x65F6;&#xFF0C;&#x65B9;&#x4FBF;&#x5730;&#x8FDB;&#x884C; Linux &#x4E0B;&#x7684;&#x5F00;&#x53D1;&#xFF0C;&#x5E76;&#x4E14; Linux &#x5B50;&#x7CFB;&#x7EDF;&#x4E0A;&#x53EF;&#x4EE5;&#x8BBF;&#x95EE; Windows &#x7684;&#x6587;&#x4EF6;&#x7CFB;&#x7EDF;&#x3002;&#x4F46;&#x662F;&#xFF0C;WSL &#x5728;&#x5B89;&#x88C5; Rust &#x65F6;&#x4F1A;&#x51FA;&#x73B0;&#x73AF;&#x5883;&#x914D;&#x7F6E;&#x65B9;&#x9762;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x56E0;&#x6B64;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x91C7;&#x7528;&#x65B0;&#x7248;&#x7684; WSL&#xFF0C;&#x5373; WSL 2&#x3002;</p>
<p>&#x6CE8;&#x610F; Ubuntu18.04 &#x7248;&#x672C;&#x53EF;&#x4EE5;&#x6B63;&#x5E38;&#x8FDB;&#x884C;&#x5B9E;&#x9A8C;&#xFF0C;&#x800C; Ubuntu20.04 &#x7248;&#x672C;&#x4F1A;&#x6709;&#x4E00;&#x4E9B;&#x5C0F;&#x95EE;&#x9898;&#x3002;</p>
<p>WSL 2 &#x548C; Ubuntu &#x73AF;&#x5883;&#x5B89;&#x88C5;&#x6B65;&#x9AA4;&#xFF1A;</p>
<ul>
<li>&#x5347;&#x7EA7; Windows 10 &#x5230;&#x6700;&#x65B0;&#x7248;&#xFF08;Windows 10 &#x7248;&#x672C; 18917 &#x6216;&#x4EE5;&#x540E;&#x7684;&#x5185;&#x90E8;&#x7248;&#x672C;&#xFF09;<ul>
<li>&#x5982;&#x679C;&#x4E0D;&#x662F; Windows 10 &#x4E13;&#x4E1A;&#x7248;&#xFF0C;&#x53EF;&#x80FD;&#x9700;&#x8981;&#x624B;&#x52A8;&#x66F4;&#x65B0;&#xFF0C;&#x5728;&#x5FAE;&#x8F6F;&#x5B98;&#x7F51;&#x4E0A;&#x4E0B;&#x8F7D;&#x3002;&#x5426;&#x5219;&#xFF0C;WSL &#x529F;&#x80FD;&#x53EF;&#x80FD;&#x4E0D;&#x80FD;&#x542F;&#x52A8;</li>
<li>&#x5728; PowerShell &#x4E2D;&#x8F93;&#x5165; <code>winver</code> &#x67E5;&#x770B;<strong>&#x5185;&#x90E8;&#x7248;&#x672C;</strong>&#x53F7;</li>
</ul>
</li>
<li>&#x300C;Windows &#x8BBE;&#x7F6E; &gt; &#x66F4;&#x65B0;&#x548C;&#x5B89;&#x5168; &gt; Windows &#x9884;&#x89C8;&#x4F53;&#x9A8C;&#x8BA1;&#x5212;&#x300D;&#x5904;&#x9009;&#x62E9;&#x52A0;&#x5165;&#xFF0C;Dev &#x5F00;&#x53D1;&#x8005;&#x6A21;&#x5F0F;</li>
<li>&#x6253;&#x5F00; PowerShell &#x7EC8;&#x7AEF;&#xFF08;<strong>&#x7BA1;&#x7406;&#x5458;&#x8EAB;&#x4EFD;</strong>&#xFF09;&#xFF0C;&#x8F93;&#x5165;&#xFF1A;</li>
</ul>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-powershell"><span class="hljs-comment"># &#x542F;&#x7528; Windows &#x529F;&#x80FD;&#xFF1A;&#x201C;&#x9002;&#x7528;&#x4E8E; Linux &#x7684; Windows &#x5B50;&#x7CFB;&#x7EDF;&#x201D;</span>
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

<span class="hljs-comment"># &#x542F;&#x7528; Windows &#x529F;&#x80FD;&#xFF1A;&#x201C;&#x5DF2;&#x5B89;&#x88C5;&#x7684;&#x865A;&#x62DF;&#x673A;&#x5E73;&#x53F0;&#x201D;</span>
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

<span class="hljs-comment"># &lt;Distro&gt; &#x6539;&#x4E3A;&#x5BF9;&#x5E94;&#x4ECE;&#x5FAE;&#x8F6F;&#x5E94;&#x7528;&#x5546;&#x5E97;&#x5B89;&#x88C5;&#x7684; Linux &#x7248;&#x672C;&#x540D;&#xFF0C;&#x6BD4;&#x5982;&#xFF1A;`wsl --set-version Ubuntu 2`</span>
<span class="hljs-comment"># &#x5982;&#x679C;&#x4F60;&#x6CA1;&#x6709;&#x63D0;&#x524D;&#x4ECE;&#x5FAE;&#x8F6F;&#x5E94;&#x7528;&#x5546;&#x5E97;&#x5B89;&#x88C5;&#x4EFB;&#x4F55; Linux &#x7248;&#x672C;&#xFF0C;&#x8BF7;&#x8DF3;&#x8FC7;&#x6B64;&#x6B65;&#x9AA4;</span>
wsl --set-version &lt;Distro&gt; <span class="hljs-number">2</span>

<span class="hljs-comment"># &#x8BBE;&#x7F6E;&#x9ED8;&#x8BA4;&#x4E3A; WSL 2&#xFF0C;&#x5982;&#x679C; Windows &#x7248;&#x672C;&#x4E0D;&#x591F;&#xFF0C;&#x8FD9;&#x6761;&#x547D;&#x4EE4;&#x4F1A;&#x51FA;&#x9519;</span>
wsl --set-default-version <span class="hljs-number">2</span>
</code></pre>
<ul>
<li>&#x5728;&#x5FAE;&#x8F6F;&#x5546;&#x5E97;&#xFF08;Microsoft Store&#xFF09;&#x4E2D;&#x641C;&#x7D22; Ubuntu&#xFF0C;&#x5B89;&#x88C5;&#x7B2C;&#x4E00;&#x4E2A;&#xFF08;&#x6216;&#x8005;&#x4F60;&#x60F3;&#x8981;&#x7684;&#x7248;&#x672C;&#xFF09;<ul>
<li>&#x5728;<a href="https://docs.microsoft.com/zh-cn/windows/wsl/wsl2-kernel" target="_blank">&#x6B64;&#x5904;</a>&#x4E0B;&#x8F7D; WSL 2 &#x7684; Linux &#x5185;&#x6838;&#x66F4;&#x65B0;&#x5305;</li>
<li>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x6253;&#x5F00; Ubuntu&#xFF0C;&#x8FDB;&#x884C;&#x521D;&#x59CB;&#x5316;</li>
</ul>
</li>
<li>&#x56DE;&#x5230; PowerShell &#x7EC8;&#x7AEF;&#xFF0C;&#x8F93;&#x5165;&#xFF1A;</li>
</ul>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-powershell"><span class="hljs-comment"># &#x67E5;&#x770B; WSL &#x7684;&#x7248;&#x672C;&#x662F;&#x5426;&#x4E3A; 2</span>
<span class="hljs-comment"># &#x53EF;&#x7B80;&#x5199;&#x4E3A; `wsl -l -v`</span>
wsl --list --verbose
</code></pre>
<ul>
<li>&#x82E5;&#x5F97;&#x5230;&#x7684;&#x7248;&#x672C;&#x4FE1;&#x606F;&#x6B63;&#x786E;&#xFF0C;&#x7ED3;&#x675F;&#x3002;WSL 2 &#x548C; Ubuntu &#x73AF;&#x5883;&#x5B89;&#x88C5;&#x5B8C;&#x6BD5;&#x3002;</li>
</ul>
<p>&#x5728;&#x6784;&#x5EFA;&#x5B8C;&#x6210; WSL 2 + Ubuntu &#x73AF;&#x5883;&#x540E;&#xFF0C;&#x53EF;&#x4EE5;&#x5728; Windows &#x7684; Linux &#x5B50;&#x7CFB;&#x7EDF;&#x4E0B;&#x4FBF;&#x6377;&#x5730;&#x90E8;&#x7F72; Linux &#x73AF;&#x5883;&#x3002;&#x8BF7;&#x67E5;&#x770B;&#x4E0A;&#x6587; Linux &#x73AF;&#x5883;&#x642D;&#x5EFA;&#x6B65;&#x9AA4;&#x3002;</p>
<h3 id="&#x5B8C;&#x6210;&#x540E;">&#x5B8C;&#x6210;&#x540E;</h3>
<p>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#x53EF;&#x4EE5;&#x7528; <code>qemu-system-riscv64 --version</code> &#x547D;&#x4EE4;&#x68C0;&#x67E5;&#x662F;&#x5426;&#x6210;&#x529F;&#x5B89;&#x88C5;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7684; RISC-V 64 &#x865A;&#x62DF;&#x5668;&#x3002;</p>
<h2 id="&#x5B89;&#x88C5;-rust-&#x5DE5;&#x5177;&#x94FE;">&#x5B89;&#x88C5; Rust &#x5DE5;&#x5177;&#x94FE;</h2>
<p>&#x9996;&#x5148;&#x5B89;&#x88C5; Rust &#x7248;&#x672C;&#x7BA1;&#x7406;&#x5668; rustup &#x548C; Rust &#x5305;&#x7BA1;&#x7406;&#x5668; cargo&#xFF0C;&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x7528;&#x5B98;&#x65B9;&#x7684;&#x5B89;&#x88C5;&#x811A;&#x672C;&#x6765;&#x5B89;&#x88C5;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash">curl https://sh.rustup.rs <span class="hljs-_">-s</span>Sf | sh
</code></pre>
<p>&#x5982;&#x679C;&#x901A;&#x8FC7;&#x5B98;&#x65B9;&#x7684;&#x811A;&#x672C;&#x4E0B;&#x8F7D;&#x5931;&#x8D25;&#x4E86;&#xFF0C;&#x53EF;&#x4EE5;&#x5728;&#x6D4F;&#x89C8;&#x5668;&#x7684;&#x5730;&#x5740;&#x680F;&#x4E2D;&#x8F93;&#x5165; <a href="https://sh.rustup.rs" target="_blank">https://sh.rustup.rs</a> &#x6765;&#x4E0B;&#x8F7D;&#x811A;&#x672C;&#xFF0C;&#x5728;&#x672C;&#x5730;&#x8FD0;&#x884C;&#x5373;&#x53EF;&#x3002;</p>
<p>&#x5982;&#x679C;&#x5B98;&#x65B9;&#x7684;&#x811A;&#x672C;&#x5728;&#x8FD0;&#x884C;&#x65F6;&#x51FA;&#x73B0;&#x4E86;&#x7F51;&#x7EDC;&#x901F;&#x5EA6;&#x8F83;&#x6162;&#x7684;&#x95EE;&#x9898;&#xFF0C;<strong>&#x53EF;&#x9009;&#x5730;</strong>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x4FEE;&#x6539; rustup &#x7684;&#x955C;&#x50CF;&#x5730;&#x5740;&#xFF08;&#x4FEE;&#x6539;&#x4E3A;&#x4E2D;&#x56FD;&#x79D1;&#x5B66;&#x6280;&#x672F;&#x5927;&#x5B66;&#x7684;&#x955C;&#x50CF;&#x670D;&#x52A1;&#x5668;&#xFF09;&#x6765;&#x52A0;&#x901F;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash"><span class="hljs-built_in">export</span> RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
<span class="hljs-built_in">export</span> RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
curl https://sh.rustup.rs <span class="hljs-_">-s</span>Sf | sh
</code></pre>
<p><strong>&#x6216;&#x8005;</strong>&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5728;&#x8FD0;&#x884C;&#x524D;&#x8BBE;&#x7F6E;&#x547D;&#x4EE4;&#x884C;&#x4E2D;&#x7684;&#x79D1;&#x5B66;&#x4E0A;&#x7F51;&#x4EE3;&#x7406;&#x6765;&#x5B9E;&#x73B0;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash"><span class="hljs-comment"># e.g. Shadowsocks &#x4EE3;&#x7406;</span>
<span class="hljs-built_in">export</span> https_proxy=http://127.0.0.1:1080
<span class="hljs-built_in">export</span> http_proxy=http://127.0.0.1:1080
<span class="hljs-built_in">export</span> ftp_proxy=http://127.0.0.1:1080
</code></pre>
<p>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x91CD;&#x65B0;&#x6253;&#x5F00;&#x4E00;&#x4E2A;&#x7EC8;&#x7AEF;&#x6765;&#x8BA9;&#x4E4B;&#x524D;&#x8BBE;&#x7F6E;&#x7684;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x751F;&#x6548;&#x3002;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x624B;&#x52A8;&#x5C06;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x8BBE;&#x7F6E;&#x5E94;&#x7528;&#x5230;&#x5F53;&#x524D;&#x7EC8;&#x7AEF;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x8F93;&#x5165;&#x4EE5;&#x4E0B;&#x547D;&#x4EE4;&#xFF1A;</p>
<pre><code class="lang-bash"><span class="hljs-built_in">source</span> <span class="hljs-variable">$HOME</span>/.cargo/env
</code></pre>
<p>&#x63A5;&#x4E0B;&#x6765;&#xFF0C;&#x6211;&#x4EEC;&#x53EF;&#x4EE5;&#x786E;&#x8BA4;&#x4E00;&#x4E0B;&#x6211;&#x4EEC;&#x6B63;&#x786E;&#x5B89;&#x88C5;&#x4E86; Rust &#x5DE5;&#x5177;&#x94FE;&#xFF1A;</p>
<pre><code class="lang-bash">rustc --version
</code></pre>
<p>&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5F53;&#x524D;&#x5B89;&#x88C5;&#x7684;&#x5DE5;&#x5177;&#x94FE;&#x7684;&#x7248;&#x672C;&#x3002;</p>
<pre><code class="lang-bash">rustc 1.46.0-nightly (7750c3d46 2020-06-26)
</code></pre>
<p>&#x6211;&#x4EEC;<strong>&#x6700;&#x597D;</strong>&#x628A;&#x8F6F;&#x4EF6;&#x5305;&#x7BA1;&#x7406;&#x5668; cargo &#x6240;&#x7528;&#x7684;&#x8F6F;&#x4EF6;&#x5305;&#x955C;&#x50CF;&#x5730;&#x5740; crates.io &#x4E5F;&#x6362;&#x6210;&#x4E2D;&#x56FD;&#x79D1;&#x5B66;&#x6280;&#x672F;&#x5927;&#x5B66;&#x7684;&#x955C;&#x50CF;&#x670D;&#x52A1;&#x5668;&#x6765;&#x52A0;&#x901F;&#x4E09;&#x65B9;&#x5E93;&#x7684;&#x4E0B;&#x8F7D;&#x3002;&#x6211;&#x4EEC;&#x6253;&#x5F00;&#xFF08;&#x5982;&#x679C;&#x6CA1;&#x6709;&#x5C31;&#x65B0;&#x5EFA;&#xFF09;<code>~/.cargo/config</code> &#x6587;&#x4EF6;&#xFF0C;&#x5E76;&#x628A;&#x5185;&#x5BB9;&#x4FEE;&#x6539;&#x4E3A;&#xFF1A;</p>
<p></p><p class="code-label">~/.cargo/config</p><p></p>
<pre><code class="lang-toml"><span class="hljs-section">[source.crates-io]</span>
<span class="hljs-attr">registry</span> = <span class="hljs-string">&quot;https://github.com/rust-lang/crates.io-index&quot;</span>
<span class="hljs-attr">replace-with</span> = <span class="hljs-string">&apos;ustc&apos;</span>
<span class="hljs-section">[source.ustc]</span>
<span class="hljs-attr">registry</span> = <span class="hljs-string">&quot;git://mirrors.ustc.edu.cn/crates.io-index&quot;</span>
</code></pre>
<h2 id="&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;">&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;</h2>
<p>&#x5728;&#x76F8;&#x5173;&#x8F6F;&#x4EF6;&#x5305;&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#xFF0C;&#x53EA;&#x9700;&#x8981;&#x4E0B;&#x9762;&#x7684;&#x547D;&#x4EE4;&#xFF0C;&#x5C31;&#x53EF;&#x4EE5;&#x628A;&#x6574;&#x4E2A;&#x6559;&#x7A0B;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#x7684; rCore &#x7CFB;&#x7EDF;&#x5728;&#x4F60;&#x7684;&#x7CFB;&#x7EDF;&#x4E0A;&#x8FD0;&#x884C;&#x8D77;&#x6765;&#xFF1A;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x547D;&#x4EE4;</p><p></p>
<pre><code class="lang-bash"><span class="hljs-comment"># &#x514B;&#x9686;&#x4ED3;&#x5E93;&#x5E76;&#x7F16;&#x8BD1;&#x8FD0;&#x884C;</span>
git <span class="hljs-built_in">clone</span> https://github.com/rcore-os/rCore-Tutorial
<span class="hljs-built_in">cd</span> rCore-Tutorial
git checkout master

<span class="hljs-comment"># &#x6DFB;&#x52A0;&#x4E00;&#x4E9B;&#x7F16;&#x8BD1;&#x4F9D;&#x8D56;</span>
<span class="hljs-comment"># &#x589E;&#x52A0;RISC-V&#x4E09;&#x5143;&#x7EC4;</span>
rustup target add riscv64imac-unknown-none-elf
<span class="hljs-comment"># &#x589E;&#x52A0;&#x9700;&#x8981;&#x7684; cargo-binutils</span>
cargo install cargo-binutils
rustup component add llvm-tools-preview

<span class="hljs-comment"># &#x7F16;&#x8BD1;&#x8FD0;&#x884C;</span>
make run
</code></pre>
<p>&#x5982;&#x679C;&#x4E00;&#x5207;&#x6B63;&#x5E38;&#xFF0C;&#x5219; QEMU &#x6A21;&#x62DF;&#x7684; RISC-V 64 &#x5904;&#x7406;&#x5668;&#x5C06;&#x8F93;&#x51FA;</p>
<p></p><p class="code-label">&#x8FD0;&#x884C;&#x8F93;&#x51FA;</p><p></p>
<pre><code class="lang-bash">OpenSBI v0.5 (Oct  9 2019 12:03:04)
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | <span class="hljs-string">&apos;_ \ / _ \ &apos;</span>_ \ \___ \|  _ &lt; | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name          : QEMU Virt Machine
Platform HART Features : RV64ACDFIMSU
Platform Max HARTs     : 8
Current Hart           : 0
Firmware Base          : 0x80000000
Firmware Size          : 116 KB
Runtime SBI Version    : 0.2

PMP0: 0x0000000080000000-0x000000008001ffff (A)
PMP1: 0x0000000000000000-0xffffffffffffffff (A,R,W,X)
mod memory initialized
mod interrupt initialized
mod driver initialized
.
..
hello_world
notebook
mod fs initialized
hello from kernel thread 7
thread 7 <span class="hljs-built_in">exit</span>
hello from kernel thread 6
thread 6 <span class="hljs-built_in">exit</span>
hello from kernel thread 5
thread 5 <span class="hljs-built_in">exit</span>
hello from kernel thread 4
thread 4 <span class="hljs-built_in">exit</span>
hello from kernel thread 3
thread 3 <span class="hljs-built_in">exit</span>
hello from kernel thread 1
thread 1 <span class="hljs-built_in">exit</span>
hello from kernel thread 8
thread 8 <span class="hljs-built_in">exit</span>
hello from kernel thread 2
thread 2 <span class="hljs-built_in">exit</span>
src/process/processor.rs:87: <span class="hljs-string">&apos;all threads terminated, shutting down&apos;</span>
</code></pre>
<p>&#x9700;&#x8981;&#x8BF4;&#x660E;&#x7684;&#x662F;&#xFF0C;Rust &#x5305;&#x542B; stable&#x3001;beta &#x548C; nightly &#x4E09;&#x4E2A;&#x7248;&#x672C;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x6211;&#x4EEC;&#x5B89;&#x88C5;&#x7684;&#x662F; stable &#x7A33;&#x5B9A;&#x7248;&#x3002;&#x7531;&#x4E8E;&#x5728;&#x7F16;&#x5199;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x65F6;&#x9700;&#x8981;&#x4F7F;&#x7528; Rust &#x7684;&#x4E00;&#x4E9B;&#x4E0D;&#x7A33;&#x5B9A;&#x7684;&#x5B9E;&#x9A8C;&#x529F;&#x80FD;&#xFF0C;&#x56E0;&#x6B64;&#x6211;&#x4EEC;&#x4F7F;&#x7528; nightly &#x6BCF;&#x65E5;&#x6784;&#x5EFA;&#x7248;&#x3002;</p>
<p>&#x4F46;&#x662F;&#xFF0C;&#x7531;&#x4E8E;&#x5B98;&#x65B9;&#x4E0D;&#x4FDD;&#x8BC1; nightly &#x7248;&#x672C;&#x7684; ABI &#x7A33;&#x5B9A;&#x6027;&#xFF0C;&#x4E5F;&#x5C31;&#x610F;&#x5473;&#x7740;&#x4ECA;&#x5929;&#x5199;&#x7684;&#x4EE3;&#x7801;&#x7528;&#x672A;&#x6765;&#x7684; nightly &#x53EF;&#x80FD;&#x65E0;&#x6CD5;&#x7F16;&#x8BD1;&#x901A;&#x8FC7;&#xFF0C;&#x56E0;&#x6B64;&#x4E00;&#x822C;&#x5728;&#x4F7F;&#x7528; nightly &#x65F6;&#x5E94;&#x8BE5;&#x9501;&#x5B9A;&#x4E00;&#x4E2A;&#x65E5;&#x671F;&#x3002;</p>
<p>&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x7684;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;&#x4E0B;&#x4F1A;&#x6709;&#x4E00;&#x4E2A;&#x540D;&#x4E3A; <code>rust-toolchain</code> &#x7684;&#x6587;&#x4EF6;&#xFF08;&#x65E0;&#x540E;&#x7F00;&#x540D;&#xFF09;&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x6709;&#x6240;&#x9700;&#x7684;&#x5DE5;&#x5177;&#x94FE;&#x7248;&#x672C;&#xFF1A;</p>
<p></p><p class="code-label">rust-toolchain</p><p></p>
<pre><code>nightly-2020-06-27
</code></pre><p>&#x5728;&#x7B2C;&#x4E00;&#x6B21;&#x7F16;&#x8BD1;&#x9879;&#x76EE;&#x65F6;&#xFF0C;rustup &#x4F1A;&#x81EA;&#x52A8;&#x53BB;&#x4E0B;&#x8F7D;&#x5BF9;&#x5E94;&#x7248;&#x672C;&#x7684;&#x5DE5;&#x5177;&#x94FE;&#x3002;&#x4ECA;&#x540E;&#x6240;&#x6709;&#x5728;&#x8FD9;&#x4E2A;&#x76EE;&#x5F55;&#x6216;&#x5176;&#x5B50;&#x76EE;&#x5F55;&#x4E0B;&#x4F7F;&#x7528; Rust &#x65F6;&#x90FD;&#x4F1A;&#x81EA;&#x52A8;&#x5207;&#x6362;&#x5230;&#x8FD9;&#x4E2A;&#x7248;&#x672C;&#x7684;&#x5DE5;&#x5177;&#x94FE;&#x3002;&#x968F;&#x7740;&#x65E5;&#x540E;&#x7684;&#x66F4;&#x65B0;&#xFF0C;&#x540E;&#x9762;&#x7684;&#x65E5;&#x671F;&#x53EF;&#x80FD;&#x4F1A;&#x53D8;&#x5316;&#xFF0C;&#x8BF7;&#x4EE5; GitHub &#x4ED3;&#x5E93;&#x4E0A;&#x7684;&#x7248;&#x672C;&#x4E3A;&#x51C6;&#x3002;</p>
<p>&#x4E07;&#x4E8B;&#x4FF1;&#x5907;&#xFF0C;&#x8BA9;&#x6211;&#x4EEC;&#x6B63;&#x5F0F;&#x5F00;&#x59CB;&#x5B9E;&#x9A8C;&#x5427;&#xFF01;</p>
<p><div id="page-footer" class="localized-footer"><hr><p><link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"></p>
<script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
<div id="gitalk-container"></div>
<script>
    var gitalk = new Gitalk({
        clientID: "5084c46751a4b2f7cd4d",
        clientSecret: "3904f62d33aef24f19480fedc836a48b31d532e9",
        repo: "rCore-Tutorial-deploy",
        owner: "rcore-os",
        admin: [
            "chyyuu",
            "wangrunji0408",
            "xy-plus",
            "wyfcyx",
            "LyricZhao",
            "Tuyixiang"
        ],
        id: location.pathname.replace('/rCore-Tutorial-deploy', '').replace('.html', ''),
        distractionFreeMode: false
    });
    gitalk.render("gitalk-container");
</script></div></p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../../notes/log.html" class="navigation navigation-prev " aria-label="Previous page: 更新日志">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="gdb.html" class="navigation navigation-next " aria-label="Next page: GDB 调试方法*">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"环境部署","level":"2.1","depth":1,"next":{"title":"GDB 调试方法*","level":"2.2","depth":1,"path":"docs/pre-lab/gdb.md","ref":"docs/pre-lab/gdb.md","articles":[]},"previous":{"title":"更新日志","level":"1.2","depth":1,"path":"notes/log.md","ref":"notes/log.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["hide-element","chapter-fold","katex","alerts","emphasize","mermaid-gb3","codeblock-label","code","search-pro","click-reveal","expandable-chapters-interactive","localized-footer"],"pluginsConfig":{"chapter-fold":{},"emphasize":{},"codeblock-label":{},"search-pro":{},"search":{},"localized-footer":{"filename":"gitalk.html","hline":"true"},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"code":{"copyButtons":true},"hide-element":{},"katex":{},"fontsettings":{"theme":"white","family":"sans","size":1},"click-reveal":{},"highlight":{},"mermaid-gb3":{},"expandable-chapters-interactive":{},"alerts":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"docs/pre-lab/env.md","mtime":"2020-10-01T11:39:40.523Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-10-01T11:40:38.595Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-mermaid-gb3/book/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-click-reveal/click_reveal.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-interactive/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    <script src="../../gitbook/gitbook-plugin-mermaid-gb3/mermaid/mermaid.min.js"></script>

    </body>
</html>

